package chalmers.game.subterranean.model.world;

import chalmers.game.subterranean.model.world.squares.ISquare;
import chalmers.game.subterranean.model.world.squares.Square;
import chalmers.game.subterranean.model.world.squares.blocks.actionblocks.Shop;
import chalmers.game.subterranean.model.world.squares.blocks.digblocks.Dirt;
import chalmers.game.subterranean.util.options.WorldValues;

public class TopLevel extends DepthLevel {

  public TopLevel(GameWorld world) {
    super(world);
    generate();
  }

  /**
   * Will fill the last row with dirt and the rest with air
   */
  @Override
  public void generate() {
    for (int y = 0; y < allSquares.length - 1; y++) {
      for (int x = 0; x < allSquares[y].length; x++) {
        allSquares[y][x] = new Square(null);
      }
    }

    for (int x = 0; x < allSquares[allSquares.length - 1].length; x++) {
      allSquares[allSquares.length - 1][x] = new Square(new Dirt());
    }

    // add shop!
    allSquares[WorldValues.LEVEL_HEIGHT - 2][WorldValues.LEVEL_WIDTH / 2] = new Square(new Shop());
  }

  @Override
  ISquare[][] getBlocks() {
    return this.allSquares;
  }
}
